//------------------------------------------------------------------------------
// <pcdd-entitiy>
//     代理业务类库
//     代理会员业务对象
// </pcdd-entitiy>
//------------------------------------------------------------------------------

using System.Collections.Generic;
using CL.Business.DAL;
using CL.Enum.Common;
using CL.View.Entity.Business;
using CL.Business.Entity;
using CL.Tools.Common;

namespace CL.Business.BLL
{

    /// <summary>
    /// AgencyUserBLL 业务
    /// </summary>
    public class AgencyUserBLL
    {
        AgencyUserDAL dal = new AgencyUserDAL(DbConnectionEnum.CaileBusiness);


        /// <summary>
        /// 插入记录
        /// </summary>
        /// <param name="Entity"></param>
        /// <returns></returns>
        public int InsertEntity(AgencyUserEntity Entity)
        {
            return dal.InsertEntity(Entity);
        }

        /// <summary>
        /// 查询对象集
        /// </summary>
        /// <param name="AccountID"></param>
        /// <returns></returns>
        public List<AgencyUserEntity> QueryEntitys(int AccountID)
        {
            return dal.QueryEntitys(AccountID);
        }

        /// <summary>
        /// 查询扩展详情
        /// </summary>
        /// <param name="AccountID"></param>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="searchKey"></param>
        /// <param name="RecordCount"></param>
        /// <returns></returns>
        public List<udv_PopularizeDetail> QueryExtendDetails(int AccountID, string StartTime, string EndTime, int PageIndex, int PageSize, string searchKey, ref int RecordCount)
        {
            return dal.QueryExtendDetails(AccountID, StartTime, EndTime, PageIndex, PageSize, searchKey, ref RecordCount);
        }
        /// <summary>
        /// 分析扩展详情
        /// </summary>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="RecordCount"></param>
        /// <returns></returns>
        public List<udv_PopularizeDetail> SelExtendDetails(string StartTime, string EndTime, int PageIndex, int PageSize, ref int RecordCount)
        {
            return dal.SelExtendDetails(StartTime,EndTime,PageIndex,PageSize,ref RecordCount);
        }
        /// <summary>
        /// 绑定代理会员
        /// </summary>
        /// <param name="agentCode"></param>
        /// <param name="userID"></param>
        public void BindAgentAndUser(string agentCode, string userID)
        {
            if (!string.IsNullOrEmpty(agentCode))
            {
                long uuid = 0;
                long.TryParse(DESEncrypt.Decrypt(agentCode), out uuid);
                dal.BindAgentAndUserDAL(uuid, userID);
            }
        }
    }
}
